Index | Conventions

api/v1/pos/{pono}/stock

Path: api/v1/pos/{pono}/stock

This API is JSON:API compliant.

This endpoint supports the following methods:
GET POST PATCH DELETE

This endpoint requires an OAuth bearer token, and returns errors in a standard shape. See API Conventions for authentication, error responses and paging, which apply to every endpoint.

The resource type for this endpoint is PurchaseStock
The identifier is pono-lineid

Attributes

The PurchaseStock resource type attributes are as follows:

AttributeTypeRead-onlyDescription
adddatestring (DateTime in ISO format)The date and time the stock line was added.
addinitstringThe initials of the user who added the stock line.
configNointegerStock attribute configuration number.
Note: Will not be returned in the response if value is null.
descriptionstringThe stock description. Only required if the default stock description needs to be overrridden. It is recommended this be set for special stock.
modifydatestring (DateTime in ISO format)The date and time the stock line was last modified.
modifyinitstringThe initials of the user who last modified the stock line.
qtynumberThe quantity ordered. Updating the quantity ordered has no impact on quantity received.
qtyReceivednumberThe quantity to be received. Updating the quantity received has no impact on quantity ordered.
serialsarray of objectThe serial numbers allocated to this PO line, each with its stock attributes.
See the serials section below.
stockAttrsarray of objectThe stock attributes (name/value pairs) configured for this PO line.
See the stockAttrs section below.
stockCodestringThe Jim2 stock code
stockIdintegerThe Jim2 stock number of the line's stock item.
unitstringThe unit of measure for the stock line.
unitPricenumberThe unit price. If PO is calculating prices from tax paid amounts this will be tax inclusive, otherwise this will be tax exclusive.
It is highly recommended to set only one of unitPrice, unitPriceTF, or unitPriceTP - if multiple are set the last one processed wins.
unitPriceTFnumberThe unit price exlusive of tax. Note that if PO is calculating prices from tax paid amounts the actual price set may differ due to rounding.
It is highly recommended to set only one of unitPrice, unitPriceTF, or unitPriceTP - if multiple are set the last one processed wins.
unitPriceTPnumberThe unit price inclusive of tax. Note that if PO is calculating prices from tax exclusive amounts the actual price set may differ due to rounding.
It is highly recommended to set only one of unitPrice, unitPriceTF, or unitPriceTP - if multiple are set the last one processed wins.

serials

Attributes of each element in the serials array.

AttributeTypeRead-onlyDescription
serialNostringA stock serial number.
stockAttrsarray of objectOnly applicable to stock that is serial and attributed on purchase or serial on sell.
See the serials.stockAttrs section below.

stockAttrs

Attributes of each element in the stockAttrs array.

AttributeTypeRead-onlyDescription
namestringThe attribute name.
valuestringThe attribute value. Note, this is always send as a string, but the attribute type dictates the acceptable string formats.
eg integer attributes values must be a whole number
date attribute values must be a date is ISO format
real attribute values must be a decimal string (with period as the decimal separator)checkbox values must be a boolan value ("true", or "false").

serials.stockAttrs

Attributes of each element in the serials.stockAttrs array.

AttributeTypeRead-onlyDescription
namestringThe attribute name.
valuestringThe attribute value. Note, this is always send as a string, but the attribute type dictates the acceptable string formats.
eg integer attributes values must be a whole number
date attribute values must be a date is ISO format
real attribute values must be a decimal string (with period as the decimal separator)checkbox values must be a boolan value ("true", or "false").

Example GET (Return all)

Path: api/v1/pos/10/stock

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

This is a list. To keep the example readable, only the first item below is written out; the later items have been trimmed down in this documentation. In a real response each item comes back with the data applicable to that record (as described above).

Side-loading related resources with the include query parameter is not supported on list endpoints: an include parameter is ignored here and no included section is returned. To retrieve a related resource, request it directly using the id shown in each item's relationships, or use the single-resource (get by id) endpoint, which does support include.

{
  "data": [
    {
      "id": "10-1",
      "type": "PurchaseStock",
      "attributes": {
        "qty": 2.0,
        "qtyReceived": 2.0,
        "unitPrice": 20.0,
        "unitPriceTF": 20.0,
        "unitPriceTP": 20.0,
        "configNo": 4501,
        "serials": [
          {
            "serialNo": "serial1",
            "stockAttrs": [
              {
                "name": "Colour",
                "value": "R,Red"
              },
              {
                "name": "Size",
                "value": "8,Eight"
              }
            ]
          },
          {
            "serialNo": "serial2",
            "stockAttrs": [
              {
                "name": "Colour",
                "value": "R,Red"
              },
              {
                "name": "Size",
                "value": "8,Eight"
              }
            ]
          }
        ],
        "stockAttrs": [
          {
            "name": "Colour",
            "value": "R,Red"
          },
          {
            "name": "Size",
            "value": "8,Eight"
          }
        ],
        "addinit": "API",
        "adddate": "2025-03-27T12:39:00",
        "stockId": 3,
        "stockCode": "SAMSUNG.MON.CONNECT",
        "unit": "EACH",
        "description": "Samsung Monitor Connector.",
        "modifyinit": "API",
        "modifydate": "2025-03-27T12:39:00"
      }
    },
    {
      "id": "10-2",
      "type": "PurchaseStock",
      "attributes": {
        "stockCode": "MOUSE",
        "qty": 1.0
      }
    },
    {
      "id": "10-3",
      "type": "PurchaseStock",
      "attributes": {
        "stockCode": "MOUSE2",
        "qty": 1.0
      }
    }
  ]
}

Example GET (Return specific)

Path: api/v1/pos/10/stock/10-1

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

{
  "data": {
    "id": "10-1",
    "type": "PurchaseStock",
    "attributes": {
      "qty": 2.0,
      "qtyReceived": 2.0,
      "unitPrice": 20.0,
      "unitPriceTF": 20.0,
      "unitPriceTP": 20.0,
      "configNo": 4501,
      "serials": [
        {
          "serialNo": "serial1",
          "stockAttrs": [
            {
              "name": "Colour",
              "value": "R,Red"
            },
            {
              "name": "Size",
              "value": "8,Eight"
            }
          ]
        },
        {
          "serialNo": "serial2",
          "stockAttrs": [
            {
              "name": "Colour",
              "value": "R,Red"
            },
            {
              "name": "Size",
              "value": "8,Eight"
            }
          ]
        }
      ],
      "stockAttrs": [
        {
          "name": "Colour",
          "value": "R,Red"
        },
        {
          "name": "Size",
          "value": "8,Eight"
        }
      ],
      "addinit": "API",
      "adddate": "2025-03-27T12:39:00",
      "stockId": 3,
      "stockCode": "SAMSUNG.MON.CONNECT",
      "unit": "EACH",
      "description": "Samsung Monitor Connector.",
      "modifyinit": "API",
      "modifydate": "2025-03-27T12:39:00"
    },
    "links": {
      "self": "/api/v1/pos/10/stock/10-1"
    }
  }
}

Example POST

Path: api/v1/pos/10/stock

Request:

{
    "data": {
        "type": "PurchaseStock",
        "attributes": {
            "stockCode": "SAMSUNG.MON.CONNECT",
            "stockId": 4050,
            "qty": 3.0,
            "qtyReceived": 1.0,
            "unitPriceTF": 10.0,
            "description": "Samsung Monitor Connector. New",
            "serials": [
                {
                    "serialNo": "serial1",
                    "stockAttrs": [
                        { "name": "Colour", "value": "R,Red" }
                    ]
                },
                {
                    "serialNo": "serial2"
                }
            ],
            "stockAttrs": [
                { "name": "Size", "value": "8,Eight" }
            ]
        }
    }
}

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

{
    "data": {
        "id": "10-5",
        "type": "PurchaseStock",
      "attributes": {
        "qty": 3.0,
        "qtyReceived": 1.0,
        "unitPrice": 10.0,
        "unitPriceTF": 10.0,
        "unitPriceTP": 10.0,
        "configNo": 4501,
        "serials": [
          {
            "serialNo": "serial1",
            "stockAttrs": [
              {
                "name": "Colour",
                "value": "R,Red"
              },
              {
                "name": "Size",
                "value": "8,Eight"
              }
            ]
          },
          {
            "serialNo": "serial2",
            "stockAttrs": [
              {
                "name": "Colour",
                "value": "R,Red"
              },
              {
                "name": "Size",
                "value": "8,Eight"
              }
            ]
          },
          {
            "serialNo": "serial3",
            "stockAttrs": [
              {
                "name": "Colour",
                "value": "R,Red"
              },
              {
                "name": "Size",
                "value": "8,Eight"
              }
            ]
          }
        ],
        "stockAttrs": [
          {
            "name": "Colour",
            "value": "R,Red"
          },
          {
            "name": "Size",
            "value": "8,Eight"
          }
        ],
        "addinit": "API",
        "adddate": "2025-03-27T13:15:09.3523149+11:00",
        "stockId": 3,
        "stockCode": "SAMSUNG.MON.CONNECT",
        "unit": "EACH",
        "description": "Samsung Monitor Connector. New",
        "modifyinit": "API",
        "modifydate": "2025-03-27T13:15:09.3523149+11:00"
      },
      "links": {
        "self": "/api/v1/pos/10/stock/10-5"
      }
    }
}

Example PATCH

Path: api/v1/pos/10/stock/10-1

Request:

{
    "data": {
        "id": "10-1",
        "type": "PurchaseStock",
        "attributes": {
            "qty": 5.0,
            "qtyReceived": 3.0,
            "unitPriceTF": 30.0,
            "description": "Samsung Monitor Connector. Extra",
            "serials": [
                {
                    "serialNo": "serial1",
                    "stockAttrs": [
                        { "name": "Colour", "value": "R,Red" }
                    ]
                }
            ],
            "stockAttrs": [
                { "name": "Size", "value": "8,Eight" }
            ]
        }
    }
}

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

{
    "data": {
        "id": "10-1",
        "type": "PurchaseStock",
        "attributes": {
            "qty": 5.0,
            "qtyReceived": 3.0,
            "unitPrice": 30.0,
            "unitPriceTF": 30.0,
            "unitPriceTP": 30.0,
            "configNo": 4501,
            "serials": [
                {
                    "serialNo": "serial1",
                    "stockAttrs": [
                        {
                            "name": "Colour",
                            "value": "R,Red"
                        },
                        {
                            "name": "Size",
                            "value": "8,Eight"
                        }
                    ]
                },
                {
                    "serialNo": "serial2",
                    "stockAttrs": [
                        {
                            "name": "Colour",
                            "value": "R,Red"
                        },
                        {
                            "name": "Size",
                            "value": "8,Eight"
                        }
                    ]
                }
            ],
            "stockAttrs": [
                {
                    "name": "Colour",
                    "value": "R,Red"
                },
                {
                    "name": "Size",
                    "value": "8,Eight"
                }
            ],
            "addinit": "API",
            "adddate": "2025-03-27T12:39:00",
            "stockId": 3,
            "stockCode": "SAMSUNG.MON.CONNECT",
            "unit": "EACH",
            "description": "Samsung Monitor Connector. Extra",
            "modifyinit": "API",
            "modifydate": "2025-03-27T12:39:00"
        },
      "links": {
        "self": "/api/v1/pos/10/stock/10-1"
      }
    }
}